const all = [
    {
        id:0,
        value:11
    },
    {
        id:1,
        value:22
    },
    {
        id:2,
        value:33
    },
    {
        id:3,
        value:44
    },
    {
        id:4,
        value:55
    },
    {
        id:5,
        value:66
    },
    {
        id:6,
        value:77
    },
    {
        id:7,
        value:88
    }]
let showList= all.slice(0,5)
let hideList = all.slice(5)

function add(i,obj){
    hideList = hideList.filter((item, index) => index !== i)
    // hideList = hideList.splice(i, 1)
    showList = [...showList, obj]
    console.log(showList, hideList)
}
function remove(i,obj){
    showList = showList.filter((item, index) => index !== i)
    hideList = [obj,...hideList]
    console.log(showList, hideList)
}

// 改变arr的几种方法：push  pop  unshift  shift reverse sort splice
// 不改变arr的几种方法：forEach map slice filter
// add(5,6)
// add()
remove(2,{
    id:2,
    value:33
})
console.log('================================')
add(0, {
    id:2,
    value:33
})

